#include "planner/group_expression.h"
#include "planner/rules/implementation_rules.h"

namespace optimizer {

RulePromise Rule::Promise(GroupExpression *group_expr) const {
  auto root_type = match_pattern_->Type();
  // This rule is not applicable
  if (root_type != OperatorType::LeafOperator && root_type != group_expr->Contents()->GetOpType()) {
    return RulePromise::NO_PROMISE;
  }
  if (IsPhysical())
    return RulePromise::PHYSICAL_PROMISE;
  return RulePromise::LOGICAL_PROMISE;
}

RuleSet::RuleSet() {
  AddRule(RuleSetName::PHYSICAL_IMPLEMENTATION, new LogicalGetToPhysicalSeqScan());
}

}  // namespace optimizer
